package com.sp2.dev.test.listener;

/**
 * Created by IntelliJ IDEA.
 * User: zhimingli
 * Date: 14-2-10
 * Time: 下午1:43
 * To change this template use File | Settings | File Templates.
 */
//战队成员类：具体观察者类 
public class Player implements Observer {

    private String name;

    public Player(String name) {
        this.name = name;
    }

    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    // //支援盟友方法的实现  
    public void help() {
        System.out.println("坚持住，"+this.name+"来救你！");
    }

    ////遭受攻击方法的实现，当遭受攻击时将调用战队控制中心类的通知方法notifyObserver()来通知盟友  
    public void beAttacked(AllyControlCenter acc) {
        System.out.println(this.name + "被攻击！");
        acc.notifyObserver(name);     
    }

    
}
